home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
Other Langs
/
Tickle-4.0 (tcl)
/
src
/
tar_dir.c
< prev
next >
Wrap
Text File
|
1993-10-25
|
2KB
|
113 lines
#pragma segment TAR
/*
* Macintosh Tar
*
* dir.c - routines dealing with directory selection
*
* Written by Craig Ruff
*/
#include "tar.h"
/*#include <stdio.h>*/
/*#include "tge.h"*/
short dirVRefNum; /* Selected directory VRefNum */
long dirDirID; /* Selected directory DirID */
#ifdef NEVER_DEFINED
Boolean
GetDir(text, extract)
char *text;
Boolean extract;
{
#pragma unused (extract)
char path_name[512];
path_name[0] = '\0';
return GetFolderPathName("Directory To Archive:", path_name, &dirVRefNum, &dirDirID);
}
#endif
#ifdef NEVER_DEFINED
#define ROOTDIR 2 /* WATCH OUT! Subject to change? */
#define dirID 130 /* Directory selection dialog */
/*
* GetDir - manage the directory selection dialog
*/
Boolean
GetDir(text, extract)
char *text;
Boolean extract;
{
#ifdef TCLAPPL
Point where;
SFReply reply;
WDPBRec wdpb;
HParamBlockRec volpb;
Str255 name;
char *routine = "\pGetDir";
WindowPtr myWindow;
myWindow = FrontWindow();
if (WPeek->windowKind == tgeWKind)
tge_activate(myWindow, 0);
name[0] = 1;
name[1] = 'x';
where.h = where.v = 75;
SFPPutFile(where, text, name, nil, &reply, dirID, nil);
if (!reply.good)
return(false);
name[0] = 0;
volpb.volumeParam.ioCompletion = nil;
volpb.volumeParam.ioNamePtr = name;
volpb.volumeParam.ioVRefNum = reply.vRefNum;
volpb.volumeParam.ioVolIndex = 0;
PBHGetVInfo(&volpb, false);
if (volpb.volumeParam.ioResult != noErr) {
OSAlert(routine, "\pPBHGetVInfo", name,
volpb.volumeParam.ioResult);
return(false);
}
if (volpb.volumeParam.ioVSigWord != 0x4244) {
HFSAlert();
return(false);
}
if (extract) {
/*
* If we are extracting, we only need a working
* directory vRefNum. The SFPPutFile dialog
* provides this for us.
*/
dirVRefNum = reply.vRefNum;
} else {
wdpb.ioCompletion = nil;
wdpb.ioVRefNum = reply.vRefNum;
wdpb.ioWDIndex = 0;
wdpb.ioWDProcID = 0;
wdpb.ioWDVRefNum = 0;
if (PBGetWDInfo(&wdpb, false) != noErr) {
OSAlert("\pGetDir", "\pPBGetWDInfo", nil, wdpb.ioResult);
return(false);
}
dirDirID = wdpb.ioWDDirID;
dirVRefNum = wdpb.ioWDVRefNum;
}
#else
#pragma unused (text, extract)
#endif
return(true);
}
#endif